Namespacing everything to /UVa.
[andmenj-acm.git] / UVa / 10473 - Simple Base Conversion / 10473.cpp
blobd9c25f56aa743fdbdda95ec2265c920c1f7fc2a0
1 /*
2 Problem: 10473 - Simple Base Conversion
3 Author: Andrés Mejía-Posada
4 (http://blogaritmo.factorcomun.org)
6 */
8 using namespace std;
9 #include <algorithm>
10 #include <iostream>
11 #include <iterator>
12 #include <sstream>
13 #include <fstream>
14 #include <cassert>
15 #include <climits>
16 #include <cstdlib>
17 #include <cstring>
18 #include <string>
19 #include <cstdio>
20 #include <vector>
21 #include <cmath>
22 #include <queue>
23 #include <deque>
24 #include <stack>
25 #include <map>
26 #include <set>
28 #define D(x) cout << #x " is " << x << endl
30 char buf[32];
32 int main(){
33 int n;
34 while (scanf("%31s", buf) == 1 && (n = strlen(buf)) > 0 && buf[0] != '-'){
35 int x;
36 if (n > 2 && buf[1] == 'x'){
37 sscanf(buf, "%x", &x);
38 printf("%d\n", x);
39 }else{
40 sscanf(buf, "%d", &x);
41 printf("0x%X\n", x);
44 return 0;